home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / ctutor2.zip / READGOOD.C < prev    next >
C/C++ Source or Header  |  1987-07-04  |  447b  |  20 lines

  1.                                         /* Chapter 10 - Program 5 */
  2. #include "stdio.h"
  3.  
  4. main()
  5. {
  6. FILE *fp1;
  7. char oneword[100];
  8. char c;
  9.  
  10.    fp1 = fopen("TENLINES.TXT","r");
  11.  
  12.    do {
  13.       c = fscanf(fp1,"%s",oneword); /* got one word from the file */
  14.       if (c != EOF)
  15.          printf("%s\n",oneword);    /* display it on the monitor  */
  16.    } while (c != EOF);              /* repeat until EOF           */
  17.  
  18.    fclose(fp1);
  19. }
  20.